package com.huonan.service.orderservice.service;

import com.huonan.service.orderservice.domain.Item;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @author huonan
 * @date 2020/2/27 16:15
 * @desc ItemService类，调用RestTemplate获取数据
 */
@Service
public class ItemService {


    @Autowired
    private RestTemplate restTemplate;

    Item queryItemById(int id){
        return restTemplate.getForObject("http://item-service/item/" + id, Item.class);
    }

}
